package com.netx.ebs;
import com.netx.data.EntityInstance;
import com.netx.generics.sql.Row;


public class Role extends EntityInstance {

	private String _name;
	private String _description;
	private String _login_resource;
	private Permission[] _permissions;
	
	Role(Row data, Permission[] perms) {
		super(data.getLong(1));
		_name = data.getString(2);
		_description = data.getString(3);
		_login_resource = data.getString(4);
		_permissions = perms;
	}

	public String toString() {
		return "Role: \""+_name+"\"";
	}
	
	public String getName() {
		return _name;
	}
	
	public String getDescription() {
		return _description;
	}

	public String getLoginResource() {
		return _login_resource;
	}
	
	public Permission[] getPermissions() {
		return _permissions;
	}

	// for Roles:
	void update(String name, String description, String loginResource) {
		_name = name;
		_description = description;
		_login_resource = loginResource;
	}
	
	// for Roles:
	void setPermissions(Permission[] perms) {
		_permissions = perms;
	}
}
